package cn.ym.ymcc.feign;

import cn.ym.ymcc.fallback.CourseFeignFallbackFactory;
import cn.ym.ymcc.result.JSONResult;
import com.alibaba.fastjson.JSONObject;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;


@FeignClient(name = "service-course",fallbackFactory = CourseFeignFallbackFactory.class)
public interface CourseServerFeign {

    /**
     * 获取对象
     */
    @GetMapping(value = "/courseMarket/{id}")
    public JSONResult getCourseMarketById(@PathVariable("id")Long id);

    /**
     * 查看当前登录人的购买记录
     * @param courseId
     * @return
     */
    @GetMapping("/courseUserLearn/getCourseUserLearnByCourseId/{courseId}")
    public JSONResult getCourseUserLearnByCourseId(@PathVariable("courseId") Long courseId);

    /**
     *
     *根据courseId查询课程
     * @param id
     * @return
     */
    @GetMapping(value = "/course/{id}")
    public JSONResult getCourseByCourseId(@PathVariable("id") Long id);


    /**
     * 根据courseId查询详情信息
     * @param courseId
     * @return
     */
    @GetMapping(value="/course/info/{courseId}")
    public JSONResult info(@PathVariable("courseId") String courseId);

}
